package com.juyu.miliao.common.constant;

import lombok.Getter;

/**
 * 春节活动礼物类型
 * @author xuanqicheng
 * @create 2019-28-13:40
 */
@Getter
public enum SpringFestivalActivitiesGiftEnums {
    /**
     * 春节礼物-烟花
     */
    GIFT_FIRE_WORKS("FIRE_WORKS",35,"烟花"),
    GIFT_LUCKY_BAG("LUCKY_BAG",36,"福袋"),
    GIFT_YUAN_BO("YUAN_BO",37,"元宝"),
    GIFT_MAN_MON("MAN_NMON",38,"财神"),
    GIFT_GOLDEN_PIG("GOLDEN_PIG",26,"金猪"),
    GIFT_GIFT_LIST("GIFT_LIST",-1,"礼物榜");

    private String type;

    private int giftId;

    private String message;

    SpringFestivalActivitiesGiftEnums(String type, int giftId, String message) {
        this.type = type;
        this.giftId = giftId;
        this.message = message;
    }


    public static int getGiftIdByType(String type){
        if(type.equals(GIFT_FIRE_WORKS.getType())){
            return GIFT_FIRE_WORKS.giftId;
        }else if(type.equals(GIFT_LUCKY_BAG.getType())){
            return GIFT_LUCKY_BAG.giftId;
        }else if(type.equals(GIFT_YUAN_BO.getType())){
            return GIFT_YUAN_BO.giftId;
        }else if(type.equals(GIFT_MAN_MON.getType())){
            return GIFT_MAN_MON.giftId;
        }else if(type.equals(GIFT_GOLDEN_PIG.getType())){
            return GIFT_GOLDEN_PIG.giftId;
        }else if(type.equals(GIFT_GIFT_LIST.getType())){
            return GIFT_GIFT_LIST.giftId;
        }else{
            throw new RuntimeException("不存在此类型的礼物");
        }
    }

    public static String getTypeByGiftId(int giftId){
        if(giftId==GIFT_FIRE_WORKS.getGiftId()){
            return GIFT_FIRE_WORKS.getType();
        }else if(giftId== GIFT_LUCKY_BAG.getGiftId()){
            return GIFT_LUCKY_BAG.getType();
        }else if(giftId==GIFT_YUAN_BO.getGiftId()){
            return GIFT_YUAN_BO.getType();
        }else if(giftId==GIFT_MAN_MON.getGiftId()){
            return GIFT_MAN_MON.getType();
        }else if(giftId==GIFT_GOLDEN_PIG.getGiftId()){
            return GIFT_GOLDEN_PIG.getType();
        }else if(giftId==GIFT_GIFT_LIST.getGiftId()){
            return GIFT_GIFT_LIST.getType();
        }else{
            throw new RuntimeException("春节活动不存在此类型的礼物");
        }
    }



    public static void main(String[] args) {
        for(SpringFestivalActivitiesGiftEnums enums : SpringFestivalActivitiesGiftEnums.values()){
            System.out.println(enums.getType());
        }
    }
}
